import { AppMain } from '@/layout/components'
import request from '@/utils/request'

const API_NAME = '/admin/system/sysRole'

export default {
    // 获取角色分页列表（带搜索）
    getPageList(page, limit, searchObj) {
        return request({
            url: `${API_NAME}/${page}/${limit}`,
            method: 'get',
            params: searchObj
        })
    },
    // 根据id删除角色
    removeById(id) {
        return request({
            url: `${API_NAME}/remove/${id}`,
            method: 'delete'
        })
    },
    // 保存角色
    save(role) {
        return request({
            url: `${API_NAME}/save`,
            method: `post`,
            data: role
        })
    }
    ,
    // 根据Id查询角色信息
    getRoleById(id) {
        return request({
            url: `${API_NAME}/get/${id}`,
            method: 'get'
        })
    },
    // 根据id修改角色
    updateById(role) {
        return request({
            url: `${API_NAME}/update`,
            method: 'put',
            data: role
        })
    },
    // 批量删除
    batchRemove(idList) {
        return request({
          url: `${API_NAME}/batchRemove`,
          method: `delete`,
          data: idList
        })
      }
}